/*
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2023-04-21 10:32:37
 * @LastEditors: huangtianyang
 * @LastEditTime: 2023-07-28 11:58:32
 * @FilePath: \cxl-h5\src\pages\personalCenter\wallet\refund\detailed\index.ts
 */
import { refundOrderDetailed } from '@/apis/refund'
import { storage } from '@/store/sessionStorage'
import { BasicData } from '@/utils/basicData'
import { reactive, ref } from 'vue'
import { useRoute } from 'vue-router'

export default class RefundDetailed extends BasicData {
    //刷新状态
    refreshLoading = ref(false)
    //退款状态 false 退款中 true 退款成功
    refundStatus = ref(false)
    //退款内容
    refundContent = reactive([
        { name: '退款金额', price: true, value: '' },
        { name: '申请人', price: false, value: '' },
        { name: '收款银行', price: false, value: '' },
        { name: '开户行网点', price: false, value: '' },
        { name: '银行卡号', price: false, value: '' },
        { name: '收款人姓名', price: false, value: '' },
        { name: '申请时间', price: false, value: '' }
    ])
    route: any
    userInfo: any
    constructor() {
        super()
        this.route = useRoute()
        const type = this.route.query.type
        //type = 1 退款中， 2 已退款
        this.refundStatus.value = Number(type) === 1 ? false : true
        const id = this.route.query.id

        this.userInfo = storage.get('userInfo') ? JSON.parse(storage.get('userInfo')) : null

        refundOrderDetailed(id).then(res => {
            if (res.data.value === 200) {
                this.refundContent[0].value = res.data.data.refundAmount
                this.refundContent[1].value = this.userInfo.companyName
                this.refundContent[2].value = res.data.data.brank
                this.refundContent[3].value = res.data.data.branches
                this.refundContent[4].value = res.data.data.bankAccount
                this.refundContent[5].value = res.data.data.receiverName
                this.refundContent[6].value = res.data.data.createTime
            }
            console.log(res.data.data, this.refundContent)
        })
    }
    //刷新方法
    onRefresh = () => {}
    //打开发票订单列表
    onOpenrefundOrder = () => {
        this.router.push('/refund-order')
    }
}
